<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$title}</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="__STATICADMIN__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/animate.min.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/style.min.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h2>文章修改</h2>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" name="save" id="save" action="{:U('edit')}">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">所属分类</label>
                            <div class="col-sm-10">
                                <select class="form-control m-b" name="pc" id="pc">
                                    <foreach name="tree" item="v" key="k">
                                        <option value="{$v.id}" {$v['id']==$apple_info['cate_id']?'selected':''}>
                                            <?php
                                        for($i = 1;$i < $v['level'];$i++){
                                            echo '--------';
                                        }
                                ?>
                                            {$v.category}
                                        </option>
                                    </foreach>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group has-success">
                            <label class="col-sm-2 control-label">文章标题</label>
                            <div class="col-sm-10">
                                <input type="text" name="title" id="title" value="{$apple_info.title}" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <input type="hidden" name="id" value="{$apple_info.id}">
                        <!--<div class="form-group has-success">-->
                            <!--<label class="col-sm-2 control-label">文章内容</label>-->

                            <!--<div class="col-sm-10">-->
                                <!--<input type="text" name="content" id="content" value="{$apple_info.content}" class="form-control">-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<div class="form-group has-success">-->
                            <label class="col-sm-2 control-label">内容:</label>
                            <div class="col-sm-10">
                            <script id="content" name="content" type="text/plain">{$apple_info.content}
                                </script>
                            </div>

                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" id="button" type="submit">修改</button>
                                <a class="btn btn-danger" href="javascript:history.go(-1)"><i class="fa fa-close"></i> 取消</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__STATICADMIN__/js/jquery.min.js"></script>
<script src="__STATICADMIN__/js/jquery.form.js"></script>
<script src="__STATICADMIN__/js/common.js"></script>
<script src="__STATIC__/public/layui/lay/dest/layui.all.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="__STATICPUBLIC__/bdq/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__STATICPUBLIC__/bdq/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('content');
</script>
</body>
<script>
    $(function(){
        $('#save').ajaxForm({
            beforeSubmit:checkForm,
            success: complete,
            dataType: 'json'
        });
        function checkForm() {
            if ($('#title').val() == '') {
                sxshop.error('标题不能为空');
                return false;
            }
//            if ($('#content').val() == '') {
//                sxshop.error('内容不能为空');
//                return false;
//            }
        }

        function complete(date){
            if(date.state > 0){
                sxshop.error(date.msg);
                return false;
            }else{
                sxshop.success(date.msg,'{:U("index")}');
            }
        }
    })
</script>
</html>